using System;

namespace SmartMathLibrary
{
    /// <summary>
    /// Interface to implement a LinearFunction class.
    /// </summary>
    public interface ILinearFunction
    {
        /// <summary>
        /// Gets or sets the slope of the function.
        /// </summary>
        /// <value>The slope of the function..</value>
        double Slope { get; set; }

        /// <summary>
        /// Gets or sets the translation constant of the function.
        /// </summary>
        /// <value>The translation constant of the function.</value>
        double TranslationConstant { get; set; }

        /// <summary>
        /// Gets the root of the linear function. If the function has no root the method 
        /// will throw an exception.
        /// </summary>
        /// <returns>The root of the linear function.</returns>
        Double FindRoot();

        /// <summary>
        /// Determines whether the function has a root.
        /// </summary>
        /// <returns>
        /// 	<c>true</c> if the function has a root; otherwise, <c>false</c>.
        /// </returns>
        bool HasRoot();

        /// <summary>
        /// Determines whether the current linear function [is parallel to] [the specified compare function].
        /// </summary>
        /// <param name="compare">The compare function.</param>
        /// <returns>
        /// 	<c>true</c> if the current linear function [is parallel to] [the specified compare function]; otherwise, <c>false</c>.
        /// </returns>
        bool IsParallelTo(LinearFunction compare);

        /// <summary>
        /// Determines whether the current linear function [is orthogonal to] [the specified compare function].
        /// </summary>
        /// <param name="compare">The compare function.</param>
        /// <returns>
        /// 	<c>true</c> if the current linear function [is orthogonal to] [the specified compare function]; otherwise, <c>false</c>.
        /// </returns>
        bool IsOrthogonalTo(LinearFunction compare);

        /// <summary>
        /// Transforms the current instance of a linear function to a polynomial.
        /// </summary>
        /// <returns>The transformed polynomial.</returns>
        SimplePolynomial ToPolynomial();

        /// <summary>
        /// Compares the current instance to another linear function.
        /// </summary>
        /// <param name="compare">The linear function to compare.</param>
        /// <returns>True if the functions are even otherwise, false.</returns>
        bool CompareTo(LinearFunction compare);

        /// <summary>
        /// Calculates the function f(x) at a specified x value.
        /// </summary>
        /// <param name="x">The specified x value.</param>
        /// <returns>The f(x) value at a specified x value.</returns>
        double SolveAt(double x);
    }
}